<template>
  <view class="container">
    <uni-list>
           <uni-list-item showExtraIcon="true" :extraIcon="{type: 'person-filled'}" title="昵称" :rightText="datas.username || ''" />
           <uni-list-item showExtraIcon="true" :extraIcon="{type: 'staff-filled'}" title="性别" :rightText="getGenderText(datas.gender) || ''" />
           <uni-list-item showExtraIcon="true" :extraIcon="{type: 'email-filled'}" title="年龄" :rightText="age ? age.toString() : ''"/>
           <uni-list-item showExtraIcon="true" :extraIcon="{type: 'calendar-filled'}" title="出生日期" :rightText="datas.birthday || ''" />
		    <uni-list-item showExtraIcon="true" :extraIcon="{type: 'phone-filled'}" title="电话" :rightText="datas.mobile|| ''" />
      <!-- <uni-list-item showExtraIcon="true" :extraIcon="{type: 'auth-filled'}" title="角色" :rightText="roleGroup" />
      <uni-list-item showExtraIcon="true" :extraIcon="{type: 'calendar-filled'}" title="创建日期" :rightText="user.createTime" /> -->
    </uni-list>
  </view>
</template>

<script>
  import { getUserProfile } from "@/api/system/user"
  import { formatTimestamp, getGenderText, calculateAge } from '@/utils/helpers.js';

  export default {
    data() {
      return {
        user: {},
        roleGroup: "",
        postGroup: "",
		 datas: wx.getStorageSync('user') || {},
      }
    },
    onLoad() {
      //this.getUser()
    },
    methods: {
		 formatTimestamp,
		    getGenderText
    
    },
	 computed: {
	    age() {
	      return calculateAge(this.datas.birthday);
	    }
	  }
  }
</script>

<style lang="scss">
  page {
    background-color: #ffffff;
  }
</style>
